package com.ecfront.test.server;

import com.ecfront.exception.WebSiteException;
import com.ecfront.service.EmailSender;
import com.ecfront.test.dao.SpringUtilTest;
import com.ecfront.util.email.MailContext;

import junit.framework.TestCase;

public class testEmailSender extends TestCase {
	private static EmailSender sender = (EmailSender)SpringUtilTest.getBean("mailsender");
	private static MailContext context = (MailContext)SpringUtilTest.getBean("registEmail");
	//基础发送类，所以发送都基于此方法
	public void testSender() throws WebSiteException{
        String body = "<html><head><META http-equiv=Content-Type content='text/html; charset=GBK'></HEAD><title>test</title></head><body>dear 小燕子 \n ";   
        body+="<red></red> pic <img src='cid:a'></img><br>hello<img src='http://www.todaynic.com/admin/agentimg/a459400/ecfront.gif'></img>This is Text!${username}</body></html>";   
		sender.sendMessage("free2312030@foxmail.com","火中仙" ,"标题测试");
	}
	//此测试必须在开启tomact情况下使用
	public void testSender1() throws WebSiteException{
		context.setToEmail("free2312030@163.com");
		context.setName("火中仙");
		sender.sandMessage(context);
	}
}
